// import _ from 'lodash'
// import callApi from '@xxx'
// import * as api from './api'

// import Vue from 'vue'

const SET_TEXT = 'SET_TEXT' // set用在设置

const UPDATE_TEXT = 'SET_TEXT' // update用在更新

const state = {
  text: ''
}

const getters = {
  echartsText: (state) => {
    return state.text + 'heihei'
  }
}

const mutations = {
  [SET_TEXT] (state, text) {
    state.text = text
  },
  [UPDATE_TEXT] (state, text) {
    // setTimeout(() => {
    //   state.text = text
    // }, 1000)
    state.text = text
  }
}

const actions = {
  setText ({ commit }, text) {
    // 异步请求
    setTimeout(() => {
      commit(UPDATE_TEXT, text)
    }, 2000)
  }
}

export default {
  namespaced: true,
  state,
  getters,
  actions,
  mutations
}
